<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/lolcomp/inc/init.php');
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of BaseModel
 *
 * @author Apathetic
 */
abstract class BaseModel {
    private $className;
    private $orm;
    private $id;
    private $properties;    
    
    public abstract function initTableName();
    protected function setClassName($className){
        $this->className = $className;
    }

    public function __construct($id) {
        $this->initTableName();
        $this->initProperties();
        $this->id = $id;
        if(!isset($id)){
            $this->orm = R::dispense($this->className);
        }
        else{
            $this->orm = R::dispense($this->className, $id);
        }
        
    }
    
    public function save()
    {
        $this->id = R::store($this->orm);
    }
    
    
    
    public function getProperty($name){
        return $this->orm[$name];
    }
    
    
}

?>
